package com.example.cybz.sys.controller;


import com.example.cybz.common.result.Result;
import com.example.cybz.model.sys.Region;
import com.example.cybz.sys.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 地区表 前端控制器
 * </p>
 *
 * @author mhwssad
 * @since 2025-06-26
 */
@RequiredArgsConstructor
@Api(tags = "区域接口")
@RestController
@RequestMapping("/admin/sys/region")
public class RegionController {

    private final RegionService regionService;

    // 根据区域关键字查询区域列表
    @ApiOperation("查询区域列表")
    @GetMapping("findRegionByKeyword/{keyword}")
    public Result<?> findRegionByKeyword(@PathVariable("keyword") String keyword){
        List<Region> regions = regionService.selectRegionByKeyword(keyword);
        return Result.ok(regions);
    }
}

